package springboot.config;

import org.springframework.context.annotation.Bean;

/**
 * @author zhangxin
 * @date 2021/4/22
 */
public class TestRedisConfig {

    @Bean
    public TestRedisSource redisDataSource() {

        System.out.println("redisDataSource");
        return new TestRedisSource();
    }


    public static void test1(int[] arr1, int[] arr2) {
        int[] all = new int[arr1.length + arr2.length];
        int arrIndex1 = 0;
        int arrIndex2 = 0;
        int allIndex = 0;
        while (true) {
            if (arrIndex1 >= arr1.length || arrIndex2 >= arr2.length) {
                break;
            }
            int a = arr1[arrIndex1];
            int b = arr2[arrIndex2];
            if (a < b) {
                all[allIndex] = a;
                arrIndex1++;
            } else {
                all[allIndex] = b;
                arrIndex2++;
            }
            allIndex++;
        }
        if (arrIndex1 == arr1.length) {
            for (int i = arrIndex2; i < arr2.length; i++) {
                all[allIndex] = arr2[i];
                allIndex++;
            }
        }

        if (arrIndex2 == arr2.length) {
            for (int i = arrIndex1; i < arr1.length; i++) {
                all[allIndex] = arr1[i];
                allIndex++;
            }
        }
    }


}

class TestRedisSource {

}

